<script>
	import Vue from 'vue'
	export default {
		globalData: {
		    payStatus: false,
			orderNo:null,
		}, 
		onLaunch: function() {
			uni.getSystemInfo({
				success: function(e) {   
					
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;	
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					};
					 
					// #endif  

					// #ifdef MP-WEIXIN || MP-QQ   
					Vue.prototype.StatusBar = e.statusBarHeight;  
					Vue.prototype.WindowHeight = e.windowHeight;
					let capsule = wx.getMenuButtonBoundingClientRect();
					if (capsule) {
						Vue.prototype.Custom = capsule;
						Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					}
					// #endif	
				}
			});
		},
		onShow: function(options) {
			console.log('hhjhhh :');
			console.log(options);
			if (options == null || options == '' || options.referrerInfo == null || options.referrerInfo == '') {
				return;
			}
			// 跳转回商户小程序参数示例：{"code": 0,"data":{"orderNo":"123456"},"msg": "支付成功"}
			let extraData = options.referrerInfo.extraData;
			console.log('extraData', extraData)
			if (extraData) {
				// 不管成功失败 先把支付结果赋值
				this.globalData.payStatus = extraData.code == 0 ? true : false;
				this.globalData.orderNo = extraData.data.orderNo;
			}
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	@import "colorui/main.css";
	@import "colorui/icon.css";
	page { 
		height: 100%;
	}
	.main-container {
		position: absolute;
		background-color: #8DC63F;
		left: 0;
		top: 0;
		width: 100%;
		bottom: 0;
		overflow: hidden;
	}
	.header-title {
		font-size: 36rpx;
		padding-left: 30rpx;
		color: #fff;
	}
	
	// border-radius: 16rpx;
	// box-shadow: 0rpx 2rpx 16rpx rgba($color: #000000, $alpha: 0.1);
</style>
